Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@bleed-believer/meta
Advanced tools
Adds metadata easifuly to your objects.
Since ESM hs been heavely adopted by the whole node.js
community (including transpilers, unit testing, and many other libraries), the CJS support has been removed. If you still needs the CJS compatibility, please use this version or earlier.
Use npm to get the last version:
npm i --save @bleed-believer/meta
To understand how this library works, first we need to define some concepts:
Any object that you want to write inside of, data about itself. It's common, for example, have classes that you need to specify how these classes will be instantiated and used for a particular third party tool or library. So in thoses cases you may need to write data dinamically into the prototype por example.
The data do you want to attach to the target. This data normally describes how to use the target object to another one that requires for it. We use interfaces to describe the structure of a kind of metadata.
First create an interface with the structure of your metadata:
export interface EndpointMeta {
path: string;
routes: {
method: string;
key: string;
}[];
}
Create a new instance of MetaManager
:
export const ENDPOINT = new MetaManager<EndpointMeta>();
Now you can attach metadata into your objects:
import { ENDPOINT } from './endpoint.js';
export class UserController {
get(): Promise<void> {
// bla bla bla bla bla bla
}
set(): Promise<void> {
// bla bla bla bla bla bla
}
}
ENDPOINT.set(UserController, {
path: 'user',
routes: [
{ method: 'GET', key: 'get' },
{ method: 'POST', key: 'set' },
]
});
...or get its metadata:
import { UserController } from './user.controller.js';
import { ENDPOINT } from './endpoint.js';
const meta = ENDPOINT.get(UserController);
console.log(meta);
// Prints:
// {
// path: 'user',
// routes: [
// { method: 'GET', key: 'get' },
// { method: 'POST', key: 'set' },
// ]
// }
FAQs
Manage multiple tags into your objects.
We found that @bleed-believer/meta demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.